<template>
  <div>
    <el-button plain type="primary" @click="enterHome()" style="margin-left: 20px;margin-top: 20px">进入脑电管理系统首页</el-button>
  </div>
</template>
<script>
import research from '@/api/research'
import user from '@/api/user'
import { authValidate } from '@/api/login'

export default {
  created() {
    if (Object.keys(this.$route.query).length > 0) {
      const paraStr = this.$route.query.paraStr
      console.log(this.$route.query)
      console.log(paraStr)
      let info = {}
      let userInfo = {}
      authValidate(paraStr).then(response => {
        // console.log(response.data)
        this.$store.dispatch('Jump', response.data).then(() => {
          // console.log("登陆")
          // console.log(response.data.entranceFlag)
          if(response.data.entranceFlag === 'J032'){
            this.$router.push({path:`/upload/research-manager?subjectPkId=${response.data.subjectPkId}`})
          }else if(response.data.entranceFlag === 'J203'){
            //this.$router.push({path:`/upload/upload?testeeNo=${response.data.testeeId}&subjectPkId=${response.data.subjectPkId}`})
            this.$router.push({path:`/upload/subject-manager?subjectPkId=${response.data.subjectPkId}`})
          }
        }).catch(() => {
          this.$message.error('跳转失败')
          this.$router.push({path:`/`})
        })
      }).catch(error => {
        this.$message.error('跳转失败')
        this.$router.push({path:`/`})
      })
    }else {
      this.$router.push({path:`/`})
    }

  },
  methods: {
    enterHome(){
      this.$router.push({path:`/`})
    }
  }
}
</script>

<style scoped>

</style>
